<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>JXHeader_API.java</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #000000; background-color: #ffffff; font-family: Monospaced}
table {color: #000000; background-color: #e9e8e2; font-family: Monospaced}
.java-keywords {color: #000099; font-family: Monospaced; font-weight: bold}
.java-layer-method {font-family: Monospaced; font-weight: bold}
.java-block-comment {color: #737373}
.java-string-literal {color: #99006b}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/Users/richardallenbair/Documents/Source/Projects/nonsense/jxheader/swingx/src/java/org/jdesktop/swingx/JXHeader_API.java</td></tr></table>
<pre>
<span class="java-block-comment">/*</span>
<span class="java-block-comment"> * $Id$</span>
<span class="java-block-comment"> *</span>
<span class="java-block-comment"> * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,</span>
<span class="java-block-comment"> * Santa Clara, California 95054, U.S.A. All rights reserved.</span>
<span class="java-block-comment"> *</span>
<span class="java-block-comment"> * This library is free software; you can redistribute it and/or</span>
<span class="java-block-comment"> * modify it under the terms of the GNU Lesser General Public</span>
<span class="java-block-comment"> * License as published by the Free Software Foundation; either</span>
<span class="java-block-comment"> * version 2.1 of the License, or (at your option) any later version.</span>
<span class="java-block-comment"> *</span>
<span class="java-block-comment"> * This library is distributed in the hope that it will be useful,</span>
<span class="java-block-comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<span class="java-block-comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span>
<span class="java-block-comment"> * Lesser General Public License for more details.</span>
<span class="java-block-comment"> *</span>
<span class="java-block-comment"> * You should have received a copy of the GNU Lesser General Public</span>
<span class="java-block-comment"> * License along with this library; if not, write to the Free Software</span>
<span class="java-block-comment"> * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA</span>
<span class="java-block-comment"> */</span>

<span class="java-keywords">package</span> org.jdesktop.swingx;

<span class="java-keywords">import</span> java.awt.Color;
<span class="java-keywords">import</span> java.awt.Font;
<span class="java-keywords">import</span> java.awt.GridBagConstraints;
<span class="java-keywords">import</span> java.awt.GridBagLayout;
<span class="java-keywords">import</span> java.awt.Insets;
<span class="java-keywords">import</span> javax.swing.Icon;
<span class="java-keywords">import</span> javax.swing.ImageIcon;
<span class="java-keywords">import</span> javax.swing.JLabel;
<span class="java-keywords">import</span> javax.swing.SwingUtilities;
<span class="java-keywords">import</span> javax.swing.UIManager;
<span class="java-keywords">import</span> org.jdesktop.swingx.painter.gradient.BasicGradientPainter;
<span class="java-keywords">import</span> org.jdesktop.swingx.plaf.HeaderUI;
<span class="java-keywords">import</span> org.jdesktop.swingx.plaf.JXHeaderAddon;
<span class="java-keywords">import</span> org.jdesktop.swingx.plaf.LookAndFeelAddons;

<span class="java-block-comment">/**</span>
<span class="java-block-comment"> * &lt;p&gt;&lt;code&gt;JXHeader is a simple component consisting of a title, a description, </span>
<span class="java-block-comment"> * and an icon. An example of such a component can be seen on</span>
<span class="java-block-comment"> * &lt;a href=&quot;http://jext.free.fr/header.png&quot;&gt;Romain Guys ProgX website&lt;/a&gt;&lt;/p&gt;</span>
<span class="java-block-comment"> *</span>
<span class="java-block-comment"> * &lt;p&gt;&lt;code&gt;JXHeader&lt;/code&gt; is a simple component that is also sufficiently </span>
<span class="java-block-comment"> * configurable to be useable. The description area</span>
<span class="java-block-comment"> * accepts HTML conforming to version 3.2 of the HTML standard. The icon, title,</span>
<span class="java-block-comment"> * and description are all configurable. &lt;code&gt;JXHeader&lt;/code&gt; itself extends </span>
<span class="java-block-comment"> * {@link JXPanel}, providing translucency and painting delegates.&lt;/p&gt;</span>
<span class="java-block-comment"> *</span>
<span class="java-block-comment"> * &lt;p&gt;If I were to reconstruct the ui shown in the above screenshot, I might</span>
<span class="java-block-comment"> * do so like this:&lt;br/&gt;</span>
<span class="java-block-comment"> * &lt;pre&gt;&lt;code&gt;</span>
<span class="java-block-comment"> *      JXHeader header = new JXHeader();</span>
<span class="java-block-comment"> *      header.setTitle(&quot;Timing Framework Spline Editor&quot;);</span>
<span class="java-block-comment"> *      header.setDescription(&quot;Drag control points in the display to change the &quot; +</span>
<span class="java-block-comment"> *          &quot;shape of the spline\n&quot; +</span>
<span class="java-block-comment"> *          &quot;Click the Copy Code button to generate the corrosponding Java code.&quot;);</span>
<span class="java-block-comment"> *      Icon icon = new ImageIcon(getClass().getResource(&quot;tools.png&quot;));</span>
<span class="java-block-comment"> *      header.setIcon(icon);</span>
<span class="java-block-comment"> * &lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;</span>
<span class="java-block-comment"> * </span>
<span class="java-block-comment"> * Note: The HTML support doesn&apos;t exist yet. The UI delegate needs to discover whether</span>
<span class="java-block-comment"> * the text supplied is HTML or not, and change the content type of the editor pane</span>
<span class="java-block-comment"> * being used. The problem is that if &quot;text/html&quot; is always used, the font is wrong.</span>
<span class="java-block-comment"> * This same situation will be found in other parts of the code (JXErrorPane, for instance),</span>
<span class="java-block-comment"> * so this needs to be dealt with.</span>
<span class="java-block-comment"> * </span>
<span class="java-block-comment"> * @status UNREVIEWED</span>
<span class="java-block-comment"> * @author rbair</span>
<span class="java-block-comment"> */</span>
<span class="java-keywords">public</span> <span class="java-keywords">class</span> JXHeader <span class="java-keywords">extends</span> JXPanel {
    <span class="java-block-comment">/**</span>
<span class="java-block-comment">     * JXTaskPane pluggable UI key &lt;i&gt;swingx/TaskPaneUI&lt;/i&gt;</span>
<span class="java-block-comment">     */</span>
    <span class="java-keywords">public</span> <span class="java-keywords">final</span> <span class="java-keywords">static</span> String uiClassID = <span class="java-string-literal">&quot;HeaderUI&quot;</span>;
    
    <span class="java-block-comment">/** Creates a new instance of JXHeader */</span>
    <span class="java-keywords">public</span> <span class="java-layer-method">JXHeader</span>() {
    }
    
    <span class="java-block-comment">//------------------------------------------------------------- UI Logic</span>
    
    <span class="java-block-comment">/**</span>
<span class="java-block-comment">     * @inheritDoc</span>
<span class="java-block-comment">     */</span>
    <span class="java-keywords">public</span> HeaderUI <span class="java-layer-method">getUI</span>();
    
    <span class="java-block-comment">/**</span>
<span class="java-block-comment">     * Sets the look and feel (L&amp;F) object that renders this component.</span>
<span class="java-block-comment">     *</span>
<span class="java-block-comment">     * @param ui the HeaderUI L&amp;F object</span>
<span class="java-block-comment">     * @see javax.swing.UIDefaults#getUI</span>
<span class="java-block-comment">     */</span>
    <span class="java-keywords">public</span> <span class="java-keywords">void</span> <span class="java-layer-method">setUI</span>(HeaderUI ui);
    
    <span class="java-block-comment">/**</span>
<span class="java-block-comment">     * Returns the name of the L&amp;F class that renders this component.</span>
<span class="java-block-comment">     *</span>
<span class="java-block-comment">     * @return the string {@link #uiClassID}</span>
<span class="java-block-comment">     * @see javax.swing.JComponent#getUIClassID</span>
<span class="java-block-comment">     * @see javax.swing.UIDefaults#getUI</span>
<span class="java-block-comment">     */</span>
    <span class="java-keywords">public</span> String <span class="java-layer-method">getUIClassID</span>();
    
    <span class="java-block-comment">/**</span>
<span class="java-block-comment">     * Sets the title to use. This may be either plain text, or a simplified</span>
<span class="java-block-comment">     * version of HTML, as JLabel would use.</span>
<span class="java-block-comment">     * </span>
<span class="java-block-comment">     * This property is bound.</span>
<span class="java-block-comment">     * </span>
<span class="java-block-comment">     * @param title the Title. May be null.</span>
<span class="java-block-comment">     */</span>
    <span class="java-keywords">public</span> <span class="java-keywords">void</span> <span class="java-layer-method">setTitle</span>(String title);
    
    <span class="java-block-comment">/**</span>
<span class="java-block-comment">     * Gets the title.</span>
<span class="java-block-comment">     * @return the title. May be null.</span>
<span class="java-block-comment">     */</span>
    <span class="java-keywords">public</span> String <span class="java-layer-method">getTitle</span>();
    
    <span class="java-block-comment">/**</span>
<span class="java-block-comment">     * Sets the description for this header. This may use HTML, such as</span>
<span class="java-block-comment">     * that supported by JEditorPane (version 3.2 of the HTML spec).</span>
<span class="java-block-comment">     * </span>
<span class="java-block-comment">     * This property is bound.</span>
<span class="java-block-comment">     * </span>
<span class="java-block-comment">     * @param description the description. May be null, may be HTML or plain text.</span>
<span class="java-block-comment">     */</span>
    <span class="java-keywords">public</span> <span class="java-keywords">void</span> <span class="java-layer-method">setDescription</span>(String description);
    
    <span class="java-block-comment">/**</span>
<span class="java-block-comment">     * Gets the description.</span>
<span class="java-block-comment">     * </span>
<span class="java-block-comment">     * @return description</span>
<span class="java-block-comment">     */</span>
    <span class="java-keywords">public</span> String <span class="java-layer-method">getDescription</span>();
    
    <span class="java-block-comment">/**</span>
<span class="java-block-comment">     * Sets the icon to use for the header. It is generally recommended that this </span>
<span class="java-block-comment">     * be an image 64x64 pixels in size, and that the icon have no gaps at the top.</span>
<span class="java-block-comment">     * </span>
<span class="java-block-comment">     * This property is bound.</span>
<span class="java-block-comment">     * </span>
<span class="java-block-comment">     * @param icon may be null</span>
<span class="java-block-comment">     */</span>
    <span class="java-keywords">public</span> <span class="java-keywords">void</span> <span class="java-layer-method">setIcon</span>(Icon icon);
    
    <span class="java-block-comment">/**</span>
<span class="java-block-comment">     * Gets the icon.</span>
<span class="java-block-comment">     * </span>
<span class="java-block-comment">     * @return the Icon being used. May be null.</span>
<span class="java-block-comment">     */</span>
    <span class="java-keywords">public</span> Icon <span class="java-layer-method">getIcon</span>();
}


</pre></body>
</html>
